/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mapdigit.practices.compositeui.winforms.builderstrategies;

import java.util.ArrayList;
import roboguice.application.RoboApplication;
import roboguice.inject.ContextScope;

/**
 *
 * @author jshen
 */
public class UIContextScope extends ContextScope{
    
    protected ArrayList<UIElementMembersInjector<?>> uiElementsForInjection 
            = new ArrayList<UIElementMembersInjector<?>>();
    
    public void registerViewForInjection(UIElementMembersInjector<?> injector) {
        uiElementsForInjection.add(injector);
    }
    
    @Override
    public void injectViews() {
        super.injectViews();
        for (int i = uiElementsForInjection.size() - 1; i >= 0; --i)
            uiElementsForInjection.remove(i).reallyInjectMembers();
    }
    
    public UIContextScope(RoboApplication app) {
        super(app);
    }

}
